package com.bestcem.xm.txtanls.enums;

import lombok.Getter;

/**
 * @ClassName RecordSentiEnum
 * @Description 原话情感枚举
 * @Author gy.liu
 * @Date 2021/5/14 10:46
 * @Version 1.0
 **/
@Getter
public enum RecordSentiEnum {
    /**
     * 正向
     */
    POSITIVE(1, "正向"),
    /**
     * 负向
     */
    NEGATIVE(-1, "负向"),
    /**
     * 中性
     */
    NEUTRAL(0, "中性"),
    /**
     * 未提及
     */
    NONE(-2, "未提及");

    private final String name;

    private final int index;


    RecordSentiEnum(int index, String name) {
        this.index = index;
        this.name = name;
    }

    public static String getNameByIndex(int index) {
        for (RecordSentiEnum recordSenti : RecordSentiEnum.values()) {
            if (recordSenti.index == index) {
                return recordSenti.name;
            }
        }
        return "";
    }

}
